--TEST--
CTPP Compile examples
--FILE--
<?php
	error_reporting(E_ERROR);

	ini_set("ctpp.arg_stack_size",       "10240");
	ini_set("ctpp.code_stack_size",      "10240");
	ini_set("ctpp.steps_limit",          "10240");
	ini_set("ctpp.cache_bytecode",       "0");
	ini_set("ctpp.max_functions",        "1024");

	$Examples = Array();

	$Examples["example1.tmpl"]   = "1.ct2";
	$Examples["example2.tmpl"]   = "2.ct2";
	$Examples["example3-1.tmpl"] = "3-1.ct2";
	$Examples["example3-2.tmpl"] = "3-2.ct2";
	$Examples["example3-3.tmpl"] = "3-3.ct2";
	$Examples["example3.tmpl"]   = "3.ct2";
	$Examples["example4.tmpl"]   = "4.ct2";
	$Examples["example5.tmpl"]   = "5.ct2";
	$Examples["example6.tmpl"]   = "6.ct2";
	$Examples["example7.tmpl"]   = "7.ct2";
	$Examples["example8.tmpl"]   = "8.ct2";

	// Create new class
	$T = new ctpp();

	foreach($Examples as $TemplateFileName => $BytecodeFileName)
	{
		$tmpl = $T -> parse_template("tmpl/" . $TemplateFileName);
		if (is_resource($tmpl)) { echo "parse_template('$TemplateFileName'): OK\n"; }
		else
		{
			echo "parse_template('$TemplateFileName'): ERROR\n";
			exit();
		}

		if ($T -> save_bytecode($tmpl, $BytecodeFileName)) { echo "save_bytecode('$BytecodeFileName'): OK\n";    }
		else
		{
			echo "save_bytecode('$BytecodeFileName'): ERROR\n";
			exit();
		}
	}

?>
--EXPECT--
parse_template('example1.tmpl'): OK
save_bytecode('1.ct2'): OK
parse_template('example2.tmpl'): OK
save_bytecode('2.ct2'): OK
WARNING: near line 1, pos. 16: comparison result of INTEGER VALUE is always false
WARNING: near line 2, pos. 16: comparison result of INTEGER VALUE is always true
WARNING: near line 3, pos. 18: comparison result of FLOAT VALUE is always true
WARNING: near line 4, pos. 18: comparison result of FLOAT VALUE is always true
WARNING: near line 5, pos. 20: comparison result of STRING VALUE is always true
WARNING: near line 6, pos. 17: comparison result of STRING VALUE is always true
WARNING: near line 8, pos. 16: comparison result of INTEGER VALUE is always false
WARNING: near line 10, pos. 13: comparison result of INTEGER VALUE is always true
parse_template('example3-1.tmpl'): OK
save_bytecode('3-1.ct2'): OK
parse_template('example3-2.tmpl'): OK
save_bytecode('3-2.ct2'): OK
parse_template('example3-3.tmpl'): OK
save_bytecode('3-3.ct2'): OK
WARNING: near line 1, pos. 12: comparison result of INTEGER VALUE is always true
WARNING: near line 2, pos. 12: comparison result of INTEGER VALUE is always false
WARNING: near line 3, pos. 14: comparison result of FLOAT VALUE is always true
WARNING: near line 4, pos. 14: comparison result of FLOAT VALUE is always true
WARNING: near line 5, pos. 16: comparison result of STRING VALUE is always true
WARNING: near line 6, pos. 13: comparison result of STRING VALUE is always true
WARNING: near line 8, pos. 12: comparison result of INTEGER VALUE is always true
WARNING: near line 10, pos. 13: comparison result of INTEGER VALUE is always true
parse_template('example3.tmpl'): OK
save_bytecode('3.ct2'): OK
parse_template('example4.tmpl'): OK
save_bytecode('4.ct2'): OK
parse_template('example5.tmpl'): OK
save_bytecode('5.ct2'): OK
parse_template('example6.tmpl'): OK
save_bytecode('6.ct2'): OK
parse_template('example7.tmpl'): OK
save_bytecode('7.ct2'): OK
parse_template('example8.tmpl'): OK
save_bytecode('8.ct2'): OK
